package define

import (
	"github.com/jaegertracing/jaeger/model"
	"time"
)

type Trace model.Span

type LogInfo struct {
	Timestamp time.Time `json:"timeStamp" yaml:"timeStamp"`
	Type      string    `json:"type" yaml:"type"`
	Log       string    `json:"log" yaml:"log"`
}

func DefaultMetrics() Metrics {
	return Metrics{
		TimeStamp: time.Now(),
		Cpu: Cpu{
			CpuCount:        4,
			CpuTotalPercent: 50,
		},
		Memory: Memory{
			MemTotal:       1024 * 1024 * 1204 * 8,
			MemAvailable:   1024 * 1024 * 1204 * 4,
			MemUsedPercent: 50,
		},
		Disk: Disk{
			DiskTotal: 1024 * 1024 * 1024 * 1024 * 1, // 1T
			DiskUsed:  1024 * 1024 * 1024 * 512,
			DiskFree:  1024 * 1024 * 1024 * 512,
		},
		NetWork: NetWork{
			NetworkRx: 1024 * 1024,
			NetworkTx: 0,
		},
	}
}

type Metrics struct {
	TimeStamp time.Time `json:"timeStamp" yaml:"timeStamp"`
	TimeStart time.Time `json:"timeStart" yaml:"timeStart"`
	TimeEnd   time.Time `json:"timeEnd" yaml:"timeEnd"`
	Cpu       Cpu       `json:"cpu" yaml:"cpu"`
	Memory    Memory    `json:"memory" yaml:"memory"`
	Disk      Disk      `json:"disk" yaml:"disk"`
	Cache     Cache     `json:"cache" yaml:"cache"`
	NetWork   NetWork   `json:"netWork" yaml:"netWork"`
}

type NetWork struct {
	NetworkRx float64 `json:"networkRx" yaml:"networkRx"`
	NetworkTx float64 `json:"networkTx" yaml:"networkTx"`
}

type Cpu struct {
	CpuCount        int     `json:"cpuCount" yaml:"cpuCount"`
	CpuTotalPercent float64 `json:"cpuTotalPercent" yaml:"cpuTotalPercent"`
}

type Memory struct {
	MemTotal       uint64  `json:"memTotal" yaml:"memTotal"`
	MemAvailable   uint64  `json:"memAvailable" yaml:"memAvailable"`
	MemUsedPercent float64 `json:"memUsedPercent" yaml:"memUsedPercent"`
}

type Disk struct {
	DiskTotal uint64 `json:"diskTotal" yaml:"diskTotal"`
	DiskUsed  uint64 `json:"diskUsed" yaml:"diskUsed"`
	DiskFree  uint64 `json:"diskFree" yaml:"diskFree"`
}

type Cache struct {
	CacheTotal uint64 `json:"cacheTotal" yaml:"cacheTotal"`
	CacheUsed  uint64 `json:"cacheUsed" yaml:"cacheUsed"`
	CacheFree  uint64 `json:"cacheFree" yaml:"cacheFree"`
}
